<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="user.User"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.lightbox.js"></script>
<title>Insert title here</title>
</head>
<body>
<%User user = (User)request.getSession().getAttribute("user");
	if(user!=null&&user.getUser_role().iterator().next().getId()==3){
%>
<tiles:insertTemplate template="/WEB-INF/layout_admin/layout.jsp" flush="true"> 
	<tiles:putAttribute name="body" >
		<div class="main-content">
			<c:forEach items="${buildingLockEquipmentList}" var="buildingLockEquipment" varStatus="statu">
				${buildingLockEquipment.name}
				<a href="updateBuildingLockEquipment.action?buildingLockEquipment.id=${buildingLockEquipment.id}">修改</a>  
				<a href="deleteBuildingLockEquipment.action?buildingLockEquipment.id=${buildingLockEquipment.id}" onclick="return confirm('您是否删除')">删除</a><br />
			</c:forEach>

			<s:form action="addBuildingLockEquipment" method="POST" >
				<s:textfield name="buildingLockEquipment.name" label="产品名称" />
				<s:textfield name="buildingLockEquipment.model" label="产品型号" />
				<s:textfield name="buildingLockEquipment.information" label="产品信息" />
				<s:file name="buildingLockEquipment.photo" label="产品图片" />
				
				<input type="hidden" name="buildingLockEquipment.id" value="${buildingLockEquipment.id}"/>
				
				<s:submit name="增加" label="增加" />
			</s:form>
        </div>
		
	</tiles:putAttribute>
</tiles:insertTemplate> 
<%} %>
<%User user2 = (User)request.getSession().getAttribute("user");
	if(user2==null||user2.getUser_role().iterator().next().getId()==2){
%>
	<tiles:insertTemplate template="/WEB-INF/layout/layout_product.jsp" flush="true"> 
		<tiles:putAttribute name="right" >
			<div class="main-content">
				<c:forEach items="${buildingLockEquipmentList}" var="buildingLockEquipment" varStatus="statu">
					<table width="553" height="181" border="1">
						<tr>
							<td width="158"><a href="toShowBuildingLockEquipment.action?buildingLockEquipment.id=${buildingLockEquipment.id}"><img src="buildingLockEquipmentPhoto.action?buildingLockEquipment.id=${buildingLockEquipment.id}" width="157" height="160"/></a>
							<a rel="lightbox" href="buildingLockEquipmentPhoto.action?buildingLockEquipment.id=${buildingLockEquipment.id}">查看实图</a>
							</td>
							 <td colspan="4" width="280">
							 	<p>产品名称：${buildingLockEquipment.name} ，产品型号：${buildingLockEquipment.model}</p>
							 	<p>产品信息：${buildingLockEquipment.information}</p>
							 </td>
					    </tr>
					</table>
				</c:forEach>
			</div>
		</tiles:putAttribute>
	</tiles:insertTemplate> 

<%} %>
</body>
</html>